package com.snailhd.framework.util.base;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.*;

/**
 * @author snailhd
 */
@Getter
@Setter
@Accessors(chain = true)
public class HttpResult implements Serializable {

    private Integer code;

    private String content;

    private Map<String, Set<String>> headers = new HashMap<>();

    public Map<String, Set<String>> putHeaders(String key, String value){
        Set<String> set = headers.getOrDefault(key, new HashSet<>());
        set.add(value);
        headers.put(key,set);
        return headers;
    }

    public boolean isSuccess(){
        return new Integer(200).equals(code);
    }
}
